package com.uzai.console.vo.pyq.llygoods;

import com.uzai.common.utils.Math;
import com.uzai.console.common.utils.Tools;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author liuqi
 * @date 2021年08月26日 14:31
 */
@Data
@ApiModel("朋友圈悠哉精品库商品列表返回对象")
public class PyqLlyGoodsVo {
    @ApiModelProperty("主键id")
    private Long id;
    @ApiModelProperty("商品id")
    private String llyid;
    @ApiModelProperty("商品id前半部分")
    private String goodsHeaderId;
    @ApiModelProperty("商品id后半部分")
    private String goodsTailId;
    @ApiModelProperty("标题")
    private String title;
    @ApiModelProperty("链接")
    private String url;
    @ApiModelProperty("类型")
    private String type;
    @ApiModelProperty("创建者")
    private String createBy;
    @ApiModelProperty("创建时间")
    private String time;
    @ApiModelProperty("素材标识")
    private String sn;
    @ApiModelProperty("访问量")
    private String pv;
    @ApiModelProperty("资源类型（单品、签到、凑单、合集）")
    private String resource_type;
    @ApiModelProperty("图片素材（Json数组）")
    private String pic;
    @ApiModelProperty("评论内容（Json数组）")
    private String description;
    @ApiModelProperty("评论内容（Json数组）")
    private List<String> descriptionList;
    @ApiModelProperty("文案内容")
    private String content;
    @ApiModelProperty("完整创建时间")
    private String full_time;
    @ApiModelProperty("忽略（Json数组）")
    private String favorite;
    @ApiModelProperty("中间页内容")
    private String data;
    @ApiModelProperty("中间页链接")
    private String shortlink;
    @ApiModelProperty("入库时间（天）（yyyy-MM-dd）")
    private String addDay;
    @ApiModelProperty("添加时间")
    protected Integer createTime;
    @ApiModelProperty("上传商品用户id")
    private Long userId;
    @ApiModelProperty("上传商品用户昵称")
    private String userName;
    @ApiModelProperty("上传商品用户头像")
    private String userHeadImg;
    @ApiModelProperty("推广开始时间")
    private String promotionStartTime;
    @ApiModelProperty("推广结束时间")
    private String promotionEndTime;
    @ApiModelProperty("优惠券ID")
    private String couponId;
    @ApiModelProperty("优惠券金额")
    private Double coupon;
    @ApiModelProperty("商品链接")
    private String itemUrl;

    @ApiModelProperty("平台（0-淘宝,1-拼多多）")
    private Integer platform;
    @ApiModelProperty("今日成交")
    private Integer wechatTodayTurnover;
    @ApiModelProperty("30天成交")
    private Integer wechat30dayTurnover;
    @ApiModelProperty("原价")
    private Double originalPrice;
    @ApiModelProperty("券后价")
    private Double postCouponPrice;
    @ApiModelProperty("佣金比例（百分比）")
    private Double commissionRate;
    @ApiModelProperty("佣金（券后价*佣金比例）")
    private Double commission;
    @ApiModelProperty("店铺类型 [淘宝商品：（0-集市，1-天猫） ； 拼多商品（1-个人，2-企业，3-旗舰店，4-专卖店，5-专营店，6-普通店）]")
    private Integer shopType;
    @ApiModelProperty("店铺类型名称 [淘宝商品：（0-集市，1-天猫） ； 拼多商品（1-个人，2-企业，3-旗舰店，4-专卖店，5-专营店，6-普通店）]")
    private String shopTypeName;
    @ApiModelProperty("今日发送朋友圈数量")
    private Integer todaySendPyqCount;

    @ApiModelProperty("素材类型（2-图文，5-视频号）")
    private String materialType;
    @ApiModelProperty("视频号评论内容（Json数组）")
    private String descriptionVideo;
    @ApiModelProperty("视频号评论内容（Json数组）")
    private List<String> descriptionVideoList;
    @ApiModelProperty("视频号文案内容")
    private String contentVideo;
    @ApiModelProperty("视频号对象")
    private String pyqVideoNumber;
    @ApiModelProperty("媒体对象（图片信息、视频号信息）")
    private String mediaList;

    public String getShopTypeName() {
        if(Tools.getInteger(platform).intValue() == 0){//淘宝订单
            if(Tools.getInteger(shopType).intValue() == 0){
                shopTypeName = "集市";
            }else if(Tools.getInteger(shopType).intValue() == 1){
                shopTypeName = "天猫";
            }
        }else if(Tools.getInteger(platform).intValue() == 1){
            if(Tools.getInteger(shopType).intValue() == 1){
                shopTypeName = "个人";
            }else if(Tools.getInteger(shopType).intValue() == 2){
                shopTypeName = "企业";
            }else if(Tools.getInteger(shopType).intValue() == 3){
                shopTypeName = "旗舰店";
            }else if(Tools.getInteger(shopType).intValue() == 4){
                shopTypeName = "专卖店";
            }else if(Tools.getInteger(shopType).intValue() == 5){
                shopTypeName = "专营店";
            }else if(Tools.getInteger(shopType).intValue() == 6){
                shopTypeName = "普通店";
            }
        }
        return shopTypeName;
    }

    public void setShopTypeName(String shopTypeName) {
        this.shopTypeName = shopTypeName;
    }

    public Double getCommission() {
        commission = Math.mul(Tools.getDouble(getPostCouponPrice()), Math.div(Tools.getDouble(getCommissionRate()), 100, 2), 2);
        return commission;
    }

    public void setCommission(Double commission) {
        this.commission = commission;
    }
}
